Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

124
Views
"hidden" type input value, not being send correctly via $_POST

I was wondering why I am not sending the value of the hidden input? After the browser executes the following code, I actually get the desired ID in the value tag - see the image here.

if (mysqli_num_rows($allStreets) > 0) {
  while ($display = mysqli_fetch_assoc($allStreets)){
    echo <<< HEREDOC
    <form action="allHouses.php" method="post">
      <table class='table table-striped'>
        <tr>
          <td align="left">
            {$display["name"]}
          </td>
          <td align="right">
            <input type="submit" class="btn btn-success" name="street" value="Go to all houses on this street">
            <input type="hidden" name="id" value"{$display['id']}">
          </td>
        </tr>
      </table>
    </form>
HEREDOC;
  }
} else {
  echo "No streets found";
}

And then I have a php code that doest the following:

if (isset($_POST['id'])) {
  echo var_dump($_POST['id']);
  echo "set";
} else {
  echo "not set";
}

And the output from the var_dump() is: string(0) "" set. Not 2 as I expect.
My question is why it is not holding the ID? And how could this be fixed? Thank you!

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You're missing = in value.

change this

value"{$display['id']}"

with this:

value="{$display['id']}"
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!